<?php
namespace app\common\validate;

use think\Validate;

class User extends Validate
{
    protected $rule = [
        'nick_name' => 'max:10',
        'sex' => 'in:1,2',
        'sign' => 'max:50',
        'intro' => 'max:100',
        'tel' => 'regex:/^1[345789]{1}\d{9}$/',
        'password' => 'alphaNum|length:6,16',
        'birthday' => 'dateFormat:Y-m-d',
    ];
    protected $message = [
        'nick_name.max' => '昵称不得超过10个字符',
        'sex.in' => '性别有误',
        'sign.max' => '个性签名不得超过50个字符',
        'intro.max' => '简介不得超过100个字符',
        'tel.regex' => '手机号格式错误',
        'password.alphaNum' => '登录密码只能是数字或字母',
        'password.length' => '登录密码长度为6至16个字符',
        'birthday.dateFormat' => '生日格式错误'
    ];
    protected $scene = [
      /* 'change_info' => [
          'nick_name','sex','sign','intro','tel','birthday','password'
       ],
*/
    ];
}
